CD_STOKES

Overview

Calculate drag coefficient of a sphere using Stokes law (Cd = 24/Re).

Excel Usage

=CD_STOKES(Re)
  • Re (float, required): Particle Reynolds number [-]

Returns (float): Drag coefficient [-], or error message (str) if input is invalid.

Examples

Example 1: Reynolds number of 0.1

Inputs:

Re
0.1

Excel formula:

=CD_STOKES(0.1)

Expected output:

Result
240

Example 2: Reynolds number of 0.01

Inputs:

Re
0.01

Excel formula:

=CD_STOKES(0.01)

Expected output:

Result
2400

Example 3: Upper validity limit (Re = 0.3)

Inputs:

Re
0.3

Excel formula:

=CD_STOKES(0.3)

Expected output:

Result
80

Example 4: Reynolds number of 1 (above valid range)

Inputs:

Re
1

Excel formula:

=CD_STOKES(1)

Expected output:

Result
24

Python Code

import micropip
await micropip.install(["fluids"])
from fluids.drag import Stokes as fluids_Stokes

def cd_stokes(Re):
    """
    Calculate drag coefficient of a sphere using Stokes law (Cd = 24/Re).

    See: https://fluids.readthedocs.io/fluids.drag.html#fluids.drag.Stokes

    This example function is provided as-is without any representation of accuracy.

    Args:
        Re (float): Particle Reynolds number [-]

    Returns:
        float: Drag coefficient [-], or error message (str) if input is invalid.
    """
    # Validate Reynolds number
    try:
        Re = float(Re)
    except (ValueError, TypeError):
        return "Error: Re must be a number."

    if Re <= 0:
        return "Error: Re must be positive."

    try:
        result = fluids_Stokes(Re=Re)
        if result != result:  # NaN check
            return "Calculation resulted in NaN."
        return float(result)
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator